package cn.iocoder.yudao.module.system.task;

import cn.iocoder.yudao.module.system.service.workorder.WorkOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.time.LocalDateTime;

@Component
@Configuration
@EnableScheduling
@Slf4j
public class WorkTask {
    @Autowired
    WorkOrderService workOrderService;
    /**
     * 每天凌晨启动
     */
//    @Scheduled(fixedDelay = 60000*30)
    @Scheduled(cron = "0 0 0 * * ?") // 每天0点执行
    @Async
    public void expiredTask(){
        log.info("expiredTask:"+ LocalDateTime.now());
        workOrderService.dayTask();
    }
}
